# sample dataframe
# Author ruoyan
# Create random subset for dataframe

sample_dataframe <- function(data = data.frame(), size = 0){
  name_vec <- names(data)
  data$test_id <- 1:dim(data)[1]
  selecte_id <- sample(1:dim(data)[1], size = size)
  outdata <- data[selecte_id,name_vec]
  return(outdata)
}

####Test####
# vec_1 <- round(runif(30, min = 1, max = 20), 0)
# vec_2 <- rnorm(30,mean = 0, sd = 1)
# testdata <- data.frame(vec_1, vec_2)
# head(testdata)
# dim(testdata)
# outdata <- sample_dataframe(testdata, 10)
# head(outdata)
# dim(outdata)
